package cn.sxt.logistics.mapper;

import cn.sxt.logistics.pojo.Permission;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ${author}
 * @since 2020-06-13
 */
public interface PermissionMapper extends BaseMapper<Permission> {



    IPage<Map<String,Object>> selectPermissions(IPage<Map<String,Object>> page,@Param(Constants.WRAPPER) Wrapper wrapper);


    /**
     * 根据角色的id查询出对应的权限表达式
     * @param roleId 角色id
     * @return 权限表达式集合
     */
    List<String> selectExpressionsByRoleId(Long roleId);

    /**
     * 根据角色的id查询出对应的菜单权限
     * @param roleId  角色id
     * @return  权限对象集合
     */
    List<Permission> selectPermissionsByRoleId(Long roleId);
}
